<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

class CreateProductBrandsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasTable('product_brands')) {
            Schema::create('product_brands', function (Blueprint $table) {
                $table->id();
                $table->string('name')->comment('品牌名称');
                $table->string('logo')->nullable()->comment('品牌logo');
                $table->string('url')->nullable()->comment('品牌官网');
                $table->string('remark')->nullable()->comment('品牌备注');
                $table->integer('order')->default(0)->comment('排序');
                $table->integer('cate_id')->comment('商品分类id:product_categories.id');
                $table->enum('status', ['normal', 'ban'])->default('normal')->comment('状态 normal:正常 ban:禁用');
                $table->softDeletes();
                $table->timestamps();
            });
            DB::statement("ALTER TABLE `product_brands` comment '商品品牌表'");
        }
        
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('product_brands');
    }
}
